').html(data).find(selector);
}
coming.content = data;
F._afterLoad();
}
}
}));
},
_loadIframe: function() {
var coming = F.coming,
iframe;
coming.content = iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
.attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling);
if (coming.iframe.preload) {
F.showLoading();
F._setDimension( coming );
coming.wrap.addClass('fancybox-tmp');
iframe.one('load.fb', function() {
if (coming.iframe.preload) {
$(this).data('ready', 1);
$(this).bind('load.fb', F.update);
F._afterLoad();
}
});
}
iframe.attr('src', coming.href).appendTo(coming.inner);
if (!coming.iframe.preload) {
F._afterLoad();
} else if (iframe.data('ready') !== 1) {
F.showLoading();
}
},
_loadInline : function() {
var coming = F.coming,
href = coming.href;
coming.content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7
if (coming.content.length) {
F._afterLoad();
} else {
F._error();
}
},
_preloadImages: function() {
var group = F.group,
current = F.current,
len = group.length,
cnt = current.preload ? Math.min(current.preload, len - 1) : 0,
item,
i;
for (i = 1; i <= cnt; i += 1) {
item = group[ (current.index + i ) % len ];
if (item && item.type === 'image' && item.href) {
new Image().src = item.href;
}
}
},
_afterLoad : function() {
var current = F.coming,
previous = F.current;
D.unbind('.loading');
if (!current || F.isActive === false || false === F.trigger('afterLoad', current, previous)) {
F.hideLoading();
if (current && current.wrap) {
removeWrap( current.wrap );
}
if (!previous) {
F._afterZoomOut( current );
}
F.coming = null;
return;
}
$.extend(F, {
wrap : current.wrap.addClass('fancybox-type-' + current.type + ' fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-' + current.theme + '-' + (isTouch ? 'mobile' : 'desktop') + ' ' + current.wrapCSS),
inner : current.inner,
current : current,
previous : previous
});
// Set content, margin/padding, caption, etc
F._prepare();
// Give a chance for helpers or callbacks to update elements
F.trigger('beforeShow', current, previous);
F.isOpen = false;
F.coming = null;
// Set initial dimension
F._setDimension();
F.hideLoading();
// Open overlay if is not yet open
if (current.overlay && !F.overlay.el) {
F.overlay.open( current.overlay );
}
F.transitions.open();
},
_prepare : function() {
var current = F.current,
content = current.content || '',
wrap = current.wrap,
inner = current.inner,
margin = current.margin,
padding = current.padding,
href = current.href,
type = current.type,
scrolling = current.scrolling,
caption = current.caption,
captionText = current.title,
captionType = caption.type,
placeholder = 'fancybox-placeholder',
display = 'fancybox-display',
embed;
if (type !== 'iframe' && isQuery(content) && content.length) {
if (!content.data(placeholder)) {
content.data(display, content.css('display'))
.data(placeholder, $('
').insertAfter( content ).hide() );
}
content = content.show().detach();
current.wrap.bind('onReset', function () {
if ($(this).find(content).length) {
content.css('display', content.data(display))
.replaceAll( content.data(placeholder) )
.data(placeholder, false)
.data(display, false);
}
});
}
if (type === 'swf') {
content = '
';
}
if (!(isQuery(content) && content.parent().is(current.inner))) {
current.inner.append( content );
current.content = current.inner.children(':last');
}
// Add margin / padding
$.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
if (margin[ i ]) {
wrap.css('margin' + v, getValue(margin[ i ]));
}
if (padding[ i ]) {
if (!(v === 'Bottom' && captionType === 'outside')) {
wrap.css('padding' + v, getValue(padding[ i ]) );
}
if (captionType === 'outside' || captionType === 'float') {
inner.css('border' + v + 'Width', getValue(padding[ i ]));
if (v === 'Top' || v === 'Left') {
inner.css('margin' + v, getValue(padding[ i ] * -1));
}
}
}
});
// Add caption
if ($.isFunction(captionText)) {
captionText = captionText.call(current.element, current);
}
if (isString(captionText) && $.trim(captionText) !== '') {
current.caption.wrap = $('
' + captionText + '
').appendTo( current[ captionType === 'over' ? 'inner' : 'wrap' ] );
if (captionType === 'float') {
current.caption.wrap.width( F.getViewport().w - (F.wrap.outerWidth(true) - F.inner.width() ) ).wrapInner('
');
}
}
},
_setDimension: function( object ) {
var view = F.getViewport(),
current = object || F.current,
wrap = current.wrap,
inner = current.inner,
width = current.width,
height = current.height,
minWidth = current.minWidth,
minHeight = current.minHeight,
maxWidth = current.maxWidth,
maxHeight = current.maxHeight,
margin = current.margin,
scrollOut = current.scrollOutside ? current.scrollbarWidth : 0,
margin = current.margin,
padding = current.padding,
scrolling = current.scrolling,
steps = 1,
scrollingX,
scrollingY,
hSpace,
wSpace,
origWidth,
origHeight,
ratio,
iframe,
body,
maxWidth_,
maxHeight_,
width_,
height_,
canShrink,
canExpand;
// Set scrolling
scrolling = scrolling.split(',');
scrollingX = scrolling[0];
scrollingY = scrolling[1] || scrollingX;
current.inner
.css('overflow-x', scrollingX === 'yes' ? 'scroll' : (scrollingX === 'no' ? 'hidden' : scrollingX))
.css('overflow-y', scrollingY === 'yes' ? 'scroll' : (scrollingY === 'no' ? 'hidden' : scrollingY));
wSpace = margin[1] + margin[3] + padding[1] + padding[3];
hSpace = margin[0] + margin[2] + padding[0] + padding[2];
// Calculations for the content
minWidth = getScalar( isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth );
maxWidth = getScalar( isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth );
minHeight = getScalar( isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight );
maxHeight = getScalar( isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight );
origWidth = getScalar( isPercentage(width) ? getScalar(width, 'w') - wSpace : width );
origHeight = getScalar( isPercentage(height) ? getScalar(height, 'h') - hSpace : height );
if (current.fitToView) {
maxWidth = Math.min(maxWidth, getScalar('100%', 'w') - wSpace );
maxHeight = Math.min(maxHeight, getScalar('100%', 'h') - hSpace );
}
maxWidth_ = view.w;
maxHeight_ = view.h;
if (current.type === 'iframe') {
iframe = current.content;
wrap.removeClass('fancybox-tmp');
if ((current.autoWidth || current.autoHeight) && iframe && iframe.data('ready') === 1) {
try {
if (iframe[0].contentWindow && iframe[0].contentWindow.document.location) {
body = iframe.contents().find('body');
inner.addClass( 'fancybox-tmp' );
inner.width( screen.width - wSpace ).height( 99999 );
if (scrollOut) {
body.css('overflow-x', 'hidden');
}
if (current.autoWidth) {
origWidth = body.outerWidth(true);
}
if (current.autoHeight) {
origHeight = body.outerHeight(true);
}
inner.removeClass( 'fancybox-tmp' );
}
} catch (e) {}
}
} else if ( (current.autoWidth || current.autoHeight) && !(current.type === 'image' || current.type === 'swf') ) {
inner.addClass( 'fancybox-tmp' );
// Set width or height in case we need to calculate only one dimension
if (current.autoWidth) {
inner.width( 'auto' );
} else {
inner.width( maxWidth );
}
if (current.autoHeight) {
inner.height( 'auto' );
} else {
inner.height( maxHeight );
}
if (current.autoWidth) {
origWidth = inner[0].scrollWidth || inner.width();
}
if (current.autoHeight) {
origHeight = inner[0].scrollHeight || inner.height();
}
inner.removeClass( 'fancybox-tmp' );
}
width = origWidth;
height = origHeight;
ratio = origWidth / origHeight;
if (!current.autoResize) {
wrap.css({
width : getValue( width ),
height : 'auto'
});
inner.css({
width : getValue( width ),
height : getValue( height )
});
return;
}
if (current.aspectRatio) {
if (width > maxWidth) {
width = maxWidth;
height = width / ratio;
}
if (height > maxHeight) {
height = maxHeight;
width = height * ratio;
}
if (width < minWidth) {
width = minWidth;
height = width / ratio;
}
if (height < minHeight) {
height = minHeight;
width = height * ratio;
}
} else {
width = Math.max(minWidth, Math.min(width, maxWidth));
if (current.autoHeight && current.type !== 'iframe') {
inner.width( width );
origHeight = height = inner[0].scrollHeight;
}
height = Math.max(minHeight, Math.min(height, maxHeight));
}
// Wrap element has to have fixed width, because long title can expand it
wrap.css({
width : getValue( width ),
height : 'auto'
});
inner.css({
width : getValue( width ),
height : getValue( height )
});
width_ = getScalar( wrap.outerWidth(true) );
height_ = getScalar( wrap.outerHeight(true) );
if (current.fitToView) {
// Since we do not know how many lines will be at the final, we need to
// resize box till it fits inside max dimensions
if (current.aspectRatio) {
while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
if (steps++ > 30) {
break;
}
height = Math.max(minHeight, Math.min(maxHeight, height - 10));
width = getScalar(height * ratio);
if (width < minWidth) {
width = minWidth;
height = getScalar(width / ratio);
}
if (width > maxWidth) {
width = maxWidth;
height = getScalar(width / ratio);
}
wrap.css({
width : getValue( width )
});
inner.css({
width : getValue( width ),
height : getValue( height )
});
width_ = getScalar( wrap.outerWidth(true) );
height_ = getScalar( wrap.outerHeight(true) );
}
} else {
width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_ )));
height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_ )));
}
}
if (scrollOut && scrollingX === 'auto' && (height < inner[0].scrollHeight || (isQuery(current.content) && current.content[0] && height < current.content[0].offsetHeight)) && (width + wSpace + scrollOut) < maxWidth) {
width += scrollOut;
}
wrap.css({
width : width
});
inner.css({
width : getValue( width ),
height : getValue( height )
});
width_ = getScalar( wrap.outerWidth(true) );
height_ = getScalar( wrap.outerHeight(true) );
canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
canExpand = (width_ < maxWidth_ || height_ < maxHeight_) && ( current.aspectRatio ? (width < maxWidth && height < maxHeight && width < origWidth && height < origHeight) : ((width < maxWidth || height < maxHeight) && (width < origWidth || height < origHeight)) );
current.canShrink = canShrink;
current.canExpand = canExpand;
if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
inner.height('auto');
}
},
_getPosition: function( object ) {
var obj = object || F.current,
wrap = obj.wrap,
view = F.getViewport(),
pos = {},
top = view.y,
left = view.x;
pos = {
top : getValue( Math.max(top, top + ((view.h - wrap.outerHeight(true)) * obj.topRatio)) ),
left : getValue( Math.max(left, left + ((view.w - wrap.outerWidth(true)) * obj.leftRatio)) ),
width : getValue( wrap.width() ),
height : getValue( wrap.height() )
};
return pos;
},
_afterZoomIn : function() {
var current = F.current;
if (!current) {
return;
}
if (F.lock) {
F.lock.css('overflow', 'auto');
}
F.isOpen = F.isOpened = true;
F.rebuild();
F.rebind();
if (current.caption && current.caption.wrap) {
current.caption.wrap.show().css({
'visibility' : 'visible',
'opacity' : 0,
'left' : 0
})
.animate({opacity:1}, "fast");
}
F.update();
F.wrap.css('overflow', 'visible').addClass('fancybox-open').focus();
F[ F.wrap.hasClass('fancybox-skin') ? 'wrap' : 'inner' ].addClass('fancybox-' + current.theme + '-skin-open');
if (current.caption && current.caption.wrap) {
current.caption.wrap.show().css('left', 0).animate({opacity:1}, "fast");
}
// Add empty element to simulate bottom margin, this trick helps to avoid extra element
if (current.margin[2] > 0) {
$('
').css('height', getValue( current.margin[2] - 2) ).appendTo( F.wrap );
}
F.trigger('afterShow');
F._preloadImages();
if (current.autoPlay && !F.slideshow.isActive) {
F.slideshow.start();
}
},
_afterZoomOut : function(obj) {
var cleanup = function() {
removeWrap('.fancybox-wrap');
};
F.hideLoading();
obj = obj || F.current;
if (obj && obj.wrap) {
obj.wrap.hide();
}
$.extend(F, {
group : [],
opts : {},
coming : null,
current : null,
isActive : false,
isOpened : false,
isOpen : false,
isClosing : false,
wrap : null,
skin : null,
inner : null
});
F.trigger('afterClose', obj);
if (!F.coming && !F.current) {
if (obj.overlay) {
F.overlay.close( obj.overlay, cleanup );
} else {
cleanup();
}
}
},
_translate : function( str ) {
var obj = F.coming || F.current,
arr = obj.locales[ obj.locale ];
return str.replace(/\{\{(\w+)\}\}/g, function(match, n) {
var value = arr[n];
if (value === undefined) {
return match;
}
return value;
});
}
});
/*
* Transition object
*/
F.transitions = {
_getOrig: function( object ) {
var obj = object || F.current,
wrap = obj.wrap,
element = obj.element,
orig = obj.orig,
view = F.getViewport(),
pos = {},
width = 50,
height = 50;
if (!orig && element && element.is(':visible')) {
orig = element.find('img:first:visible');
if (!orig.length) {
orig = element;
}
}
// If there is no orig element, maybe only the first thumbnail is visible
if (!orig && obj.group[0].element) {
orig = obj.group[0].element.find('img:visible:first');
}
if (isQuery(orig) && orig.is(':visible')) {
pos = orig.offset();
if (orig.is('img')) {
width = orig.outerWidth();
height = orig.outerHeight();
}
if (F.lock) {
pos.top -= W.scrollTop();
pos.left -= W.scrollLeft();
}
} else {
pos.top = view.y + (view.h - height) * obj.topRatio;
pos.left = view.x + (view.w - width) * obj.leftRatio;
}
pos = {
top : getValue( pos.top - (wrap.outerHeight(true) - wrap.height() ) * 0.5 ),
left : getValue( pos.left - (wrap.outerWidth(true) - wrap.width() ) * 0.5 ),
width : getValue( width ),
height : getValue( height )
};
return pos;
},
_getCenter: function( object ) {
var obj = object || F.current,
wrap = obj.wrap,
view = F.getViewport(),
pos = {},
top = view.y,
left = view.x;
pos = {
top : getValue( Math.max(top, top + ((view.h - wrap.outerHeight(true)) * obj.topRatio)) ),
left : getValue( Math.max(left, left + ((view.w - wrap.outerWidth(true)) * obj.leftRatio)) ),
width : getValue( wrap.width() ),
height : getValue( wrap.height() )
};
return pos;
},
_prepare : function( object, forClosing ) {
var obj = object || F.current,
wrap = obj.wrap,
inner = obj.inner;
// Little trick to avoid animating both elements and to improve performance
wrap.height( wrap.height() );
inner.css({
'width' : (inner.width() * 100 / wrap.width() ) + '%',
'height' : (Math.floor( (inner.height() * 100 / wrap.height() ) * 100 ) / 100 ) + '%'
});
if (forClosing === true) {
wrap.find('.fancybox-title, .fancybox-spacer, .fancybox-close, .fancybox-nav').remove();
}
inner.css('overflow', 'hidden');
},
fade : function( object, stage ) {
var pos = this._getCenter( object ),
opa = {opacity: 0};
return ((stage === 'open' || stage === 'changeIn') ? [ $.extend(pos, opa), {opacity: 1} ] : [ {}, opa ]);
},
drop : function( object, stage ) {
var a = $.extend(this._getCenter( object ), {opacity: 1}),
b = $.extend({}, a, {opacity: 0, top: getValue( Math.max( F.getViewport().y - object.margin[0], getScalar( a.top ) - 200 ) )});
return ((stage === 'open' || stage === 'changeIn') ? [ b, a ] : [ {}, b ]);
},
elastic : function( object, stage ) {
var wrap = object.wrap,
margin = object.margin,
view = F.getViewport(),
direction = F.direction,
pos = this._getCenter( object ),
from = $.extend({}, pos),
to = $.extend({}, pos),
prop,
amount,
value;
if (stage === 'open') {
from = this._getOrig( object );
} else if (stage === 'close') {
from = {};
to = this._getOrig( object );
} else if (direction) {
// Calculate max distance and try to avoid scrollbars
prop = (direction === 'up' || direction === 'down') ? 'top' : 'left';
amount = (direction === 'up' || direction === 'left') ? 200 : -200;
if (stage === 'changeIn') {
value = getScalar(from[ prop ]) + amount;
if (direction === 'left') {
// from viewport right to center
value = Math.min( value, view.x + view.w - margin[3] - wrap.outerWidth() - 1 );
} else if (direction === 'right') {
// from viewport left to center
value = Math.max( value, view.x - margin[1] );
} else if (direction === 'up') {
// from viewport bottom to center
value = Math.min( value, view.y + view.h - margin[0] - wrap.outerHeight() - 1);
} else {
// down - from viewport top to center
value = Math.max( value, view.y - margin[2] );
}
from[ prop ] = value;
} else {
value = getScalar(wrap.css(prop)) - amount;
from = {};
if (direction === 'left') {
// from viewport center to left
value = Math.max( value, view.x - margin[3] );
} else if (direction === 'right') {
// from viewport center to right
value = Math.min( value, view.x + view.w - margin[1] - wrap.outerWidth() - 1 );
} else if (direction === 'up') {
// from viewport center to top
value = Math.max( value, view.y - margin[0] );
} else {
// down - from center to bottom
value = Math.min( value, view.y + view.h - margin[2] - wrap.outerHeight() - 1 );
}
to[ prop ] = value;
}
}
if (stage === 'open' || stage === 'changeIn') {
from.opacity = 0;
to.opacity = 1;
} else {
to.opacity = 0;
}
return [ from, to ];
},
open : function() {
var current = F.current,
previous = F.previous,
direction = F.direction,
effect,
pos,
speed,
easing,
stage;
if (previous) {
previous.wrap.stop(true).removeClass('fancybox-opened');
}
if ( F.isOpened ) {
effect = current.nextEffect,
speed = current.nextSpeed;
easing = current.nextEasing;
stage = 'changeIn';
} else {
effect = current.openEffect;
speed = current.openSpeed;
easing = current.openEasing;
stage = 'open';
}
/*
* Open current item
*/
if (effect === 'none') {
F._afterZoomIn();
} else {
pos = this[ effect ]( current, stage );
if (effect === 'elastic') {
this._prepare( current );
}
current.wrap.css( pos[ 0 ] );
current.wrap.animate(
pos[ 1 ],
speed,
easing,
F._afterZoomIn
);
}
/*
* Close previous item
*/
if (previous) {
if (!F.isOpened || previous.prevEffect === 'none') {
// Remove previous item if it has not fully opened
removeWrap( $('.fancybox-wrap').not( current.wrap ) );
} else {
previous.wrap.stop(true).removeClass('fancybox-opened');
pos = this[ previous.prevEffect ]( previous, 'changeOut' );
this._prepare( previous, true );
previous.wrap.animate(
pos[ 1 ],
previous.prevSpeed,
previous.prevEasing,
function() {
removeWrap( previous.wrap );
}
);
}
}
},
close : function() {
var current = F.current,
wrap = current.wrap.stop(true).removeClass('fancybox-opened'),
effect = current.closeEffect,
pos;
if (effect === 'none') {
return F._afterZoomOut();
}
this._prepare( current, true );
pos = this[ effect ]( current, 'close' );
wrap.addClass('fancybox-animating')
.animate(
pos[ 1 ],
current.closeSpeed,
current.closeEasing,
F._afterZoomOut
);
}
};
/*
* Slideshow object
*/
F.slideshow = {
_clear : function () {
if (this._timer) {
clearTimeout(this._timer);
}
},
_set : function () {
this._clear();
if (F.current && this.isActive) {
this._timer = setTimeout(F.next, this._speed);
}
},
_timer : null,
_speed : null,
isActive : false,
start : function ( speed ) {
var current = F.current;
if (current && (current.loop || current.index < current.group.length - 1)) {
this.stop();
this.isActive = true;
this._speed = speed || current.playSpeed;
D.bind({
'beforeLoad.player' : $.proxy(this._clear, this),
'onUpdate.player' : $.proxy(this._set, this),
'onCancel.player beforeClose.player' : $.proxy(this.stop, this)
});
this._set();
F.trigger('onPlayStart');
}
},
stop : function () {
this._clear();
D.unbind('.player');
this.isActive = false;
this._timer = this._speed = null;
F.trigger('onPlayEnd');
},
toggle : function() {
if (this.isActive) {
this.stop();
} else {
this.start.apply(this, arguments );
}
}
};
/*
* Overlay object
*/
F.overlay = {
el : null, // current handle
theme : '', // current theme
// Public methods
open : function(opts) {
var that = this,
el = this.el,
fixed = F.defaults.fixed,
opacity,
theme;
opts = $.extend({}, F.defaults.overlay, opts);
if (el) {
el.stop(true).removeAttr('style').unbind('.overlay');
} else {
el = $('
').appendTo( opts.parent || 'body' );
}
if (opts.closeClick) {
el.bind('click.overlay', function(e) {
// fix Android touch event bubbling issue
if (F.lastTouch && (getTime() - F.lastTouch) < 300) {
return false;
}
if (F.isActive) {
F.close();
} else {
that.close();
}
return false;
});
}
theme = opts.theme || (F.coming ? F.coming.theme : 'default');
if (theme !== this.theme) {
el.removeClass('fancybox-' + this.theme + '-overlay')
}
this.theme = theme;
el.addClass('fancybox-' + theme + '-overlay').css( opts.css );
opacity = el.css('opacity');
if (!this.el && opacity < 1 && opts.speedIn) {
el.css({
opacity : 0,
filter : 'alpha(opacity=0)' // This fixes IE flickering
})
.fadeTo( opts.speedIn, opacity );
}
this.el = el;
if (!fixed) {
W.bind('resize.overlay', $.proxy( this.update, this) );
this.update();
}
},
close : function(opts, callback) {
opts = $.extend({}, F.defaults.overlay, opts);
if (this.el) {
this.el.stop(true).fadeOut(opts.speedOut, function() {
W.unbind('resize.overlay');
$('.fancybox-overlay').remove();
F.overlay.el = null;
if ($.isFunction(callback)) {
callback();
}
});
}
},
update : function () {
// Reset width/height so it will not mess
this.el.css({width: '100%', height: '100%'});
this.el.width(D.width()).height(D.height());
}
};
/*
* Touch object - adds swipe left/right events
*/
F.touch = {
startX : 0,
wrapX : 0,
dx : 0,
isMoving : false,
_start : function(e) {
var current = F.current,
data = e.originalEvent.touches ? e.originalEvent.touches[0] : e,
now = getTime();
if (!F.isOpen || F.wrap.is(':animated') || !( $(e.target).is(F.inner) || $(e.target).parent().is(F.inner) )) {
return;
}
if (F.lastTouch && (now - F.lastTouch) < 300) {
e.preventDefault();
F.lastTouch = now;
this._cancel(true);
F.toggle();
return false;
}
F.lastTouch = now;
if (F.wrap && F.wrap.outerWidth() > F.getViewport().w) {
return;
}
e.preventDefault();
if (data && F.wrap && F.wrap.outerWidth() < F.getViewport().w) {
this.startX = data.pageX;
this.wrapX = F.wrap.position().left;
this.isMoving = true;
F.inner
.bind('touchmove.fb', $.proxy(this._move, this) )
.one("touchend.fb touchcancel.fb", $.proxy(this._cancel, this) );
}
},
_move : function(e) {
var data = e.originalEvent.touches ? e.originalEvent.touches[0] : e,
dx = this.startX - data.pageX;
if (!this.isMoving || !F.isOpen) {
return;
}
this.dx = dx;
if (F.current.wrap.outerWidth(true) <= W.width()) {
if (Math.abs(dx) >= 50) {
e.preventDefault();
this.last = 0;
this._cancel(true);
if (dx > 0) {
F.next('left');
} else {
F.prev('right');
}
} else if (Math.abs(dx) > 3) {
e.preventDefault();
this.last = 0;
F.wrap.css('left', this.wrapX - dx);
}
}
},
_clear : function() {
this.startX = this.wrapX = this.dx = 0;
this.isMoving = false;
},
_cancel : function( stop ) {
if (F.inner) {
F.inner.unbind('touchmove.fb');
}
if (F.isOpen && Math.abs(this.dx) > 3) {
F.reposition(false);
}
this._clear();
},
init : function() {
var that = this;
if (F.inner && F.touch) {
this._cancel(true);
F.inner.bind('touchstart.fb', $.proxy(this._start, this));
}
}
};
/*
* Add default easing
*/
if (!$.easing.easeOutQuad) {
$.easing.easeOutQuad = function (x, t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
};
}
/*
*
*/
D.ready(function() {
var w1, w2, scrollV, scrollH;
// Tests that need a body at doc ready
if ( $.scrollbarWidth === undefined ) {
$.scrollbarWidth = function() {
var parent = $('
').appendTo('body'),
child = parent.children(),
width = child.innerWidth() - child.height( 99 ).innerWidth();
parent.remove();
return width;
};
}
if ( $.support.fixedPosition === undefined ) {
$.support.fixedPosition = (function() {
var elem = $('
').appendTo('body'),
fixed = elem.css( 'position' ) === 'fixed' && ((elem[0].offsetTop > 18 && elem[0].offsetTop < 22) || elem[0].offsetTop === 15 );
elem.remove();
return fixed;
}());
}
$.extend(F.defaults, {
scrollbarWidth : $.scrollbarWidth(),
fixed : $.support.fixedPosition,
parent : $('body')
});
// Quick and dirty code to get page scroll-bar width and create CSS style
// Workaround for FF jumping bug
scrollV = W.scrollTop();
scrollH = W.scrollLeft();
w1 = $(window).width();
H.addClass('fancybox-lock-test');
w2 = $(window).width();
H.removeClass('fancybox-lock-test');
W.scrollTop( scrollV ).scrollLeft( scrollH );
F.lockMargin = (w2 - w1);
$("").appendTo("head");
// Auto start
if ($("script[src*='jquery.fancybox.js']").attr('src').match(/autorun/) ){
$("a[href$='.jpg'],a[href$='.png'],a[href$='.gif'],.fancybox").attr('data-fancybox-group', 'gallery').fancybox();
}
});
// jQuery plugin initialization
$.fn.fancybox = function (options) {
var that = this,
selector = this.length ? this.selector : false,
live = (selector && selector.indexOf('()') < 0 && !(options && options.live === false));
var handler = function(e) {
var collection = live ? $(selector) : that,
group = $(this).blur(),
param = options.groupAttr || 'data-fancybox-group',
value = group.attr( param ),
tmp = this.rel;
if (!value && tmp && tmp !== 'nofollow') {
param = 'rel';
value = tmp;
}
if (value) {
group = collection.filter('[' + param + '="' + value + '"]');
options.index = group.index( this );
}
if (group.length) {
e.preventDefault();
F.open(group.get(), options);
}
};
options = options || {};
if (live) {
D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-close,.fancybox-nav,.fancybox-wrap')", 'click.fb-start', handler);
} else {
that.unbind('click.fb-start').bind('click.fb-start', handler);
}
return this;
};
}(window, document, jQuery));
// source --> https://penkor.com.my/penkor/js/fancybox/jquery.mousewheel-3.0.6.pack.js?ver=2f237cc19570fb25c85e1900ba8685da
/*! Copyright (c) 2011 Brandon Aaron (http://brandonaaron.net)
* Licensed under the MIT License (LICENSE.txt).
*
* Thanks to: http://adomas.org/javascript-mouse-wheel/ for some pointers.
* Thanks to: Mathias Bank(http://www.mathias-bank.de) for a scope bug fix.
* Thanks to: Seamus Leahy for adding deltaX and deltaY
*
* Version: 3.0.6
*
* Requires: 1.2.2+
*/
(function(d){function e(a){var b=a||window.event,c=[].slice.call(arguments,1),f=0,e=0,g=0,a=d.event.fix(b);a.type="mousewheel";b.wheelDelta&&(f=b.wheelDelta/120);b.detail&&(f=-b.detail/3);g=f;b.axis!==void 0&&b.axis===b.HORIZONTAL_AXIS&&(g=0,e=-1*f);b.wheelDeltaY!==void 0&&(g=b.wheelDeltaY/120);b.wheelDeltaX!==void 0&&(e=-1*b.wheelDeltaX/120);c.unshift(a,f,e,g);return(d.event.dispatch||d.event.handle).apply(this,c)}var c=["DOMMouseScroll","mousewheel"];if(d.event.fixHooks)for(var h=c.length;h;)d.event.fixHooks[c[--h]]=
d.event.mouseHooks;d.event.special.mousewheel={setup:function(){if(this.addEventListener)for(var a=c.length;a;)this.addEventListener(c[--a],e,false);else this.onmousewheel=e},teardown:function(){if(this.removeEventListener)for(var a=c.length;a;)this.removeEventListener(c[--a],e,false);else this.onmousewheel=null}};d.fn.extend({mousewheel:function(a){return a?this.bind("mousewheel",a):this.trigger("mousewheel")},unmousewheel:function(a){return this.unbind("mousewheel",a)}})})(jQuery);
// source --> https://penkor.com.my/penkor/js/jquery.touchwipe.1.1.1.js?ver=2f237cc19570fb25c85e1900ba8685da
/**
* jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!)
* Common usage: wipe images (left and right to show the previous or next image)
*
* @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
* @version 1.1.1 (9th December 2010) - fix bug (older IE's had problems)
* @version 1.1 (1st September 2010) - support wipe up and wipe down
* @version 1.0 (15th July 2010)
*/
(function($) {
$.fn.touchwipe = function(settings) {
var config = {
min_move_x: 20,
min_move_y: 20,
wipeLeft: function() { },
wipeRight: function() { },
wipeUp: function() { },
wipeDown: function() { },
preventDefaultEvents: true
};
if (settings) $.extend(config, settings);
this.each(function() {
var startX;
var startY;
var isMoving = false;
function cancelTouch() {
this.removeEventListener('touchmove', onTouchMove);
startX = null;
isMoving = false;
}
function onTouchMove(e) {
if(config.preventDefaultEvents) {
e.preventDefault();
}
if(isMoving) {
var x = e.touches[0].pageX;
var y = e.touches[0].pageY;
var dx = startX - x;
var dy = startY - y;
if(Math.abs(dx) >= config.min_move_x) {
cancelTouch();
if(dx > 0) {
config.wipeLeft();
}
else {
config.wipeRight();
}
}
else if(Math.abs(dy) >= config.min_move_y) {
cancelTouch();
if(dy > 0) {
config.wipeDown();
}
else {
config.wipeUp();
}
}
}
}
function onTouchStart(e)
{
if (e.touches.length == 1) {
startX = e.touches[0].pageX;
startY = e.touches[0].pageY;
isMoving = true;
this.addEventListener('touchmove', onTouchMove, false);
}
}
if ('ontouchstart' in document.documentElement) {
this.addEventListener('touchstart', onTouchStart, false);
}
});
return this;
};
})(jQuery);
// source --> https://penkor.com.my/penkor/js/gmap.js?ver=2f237cc19570fb25c85e1900ba8685da
/**
* jQuery gMap v3
*
* @url http://www.smashinglabs.pl/gmap
* @author Cedric Kastner
* @author Sebastian Poreba
* @version 3.0.0
* @date 20.03.2011
*
*/
(function($){$.fn.gMap=function(options){var opts=$.extend({},$.fn.gMap.defaults,options);return this.each(function(){var googlemaps=google.maps;var $this=$(this);var LatLng=new googlemaps.LatLng(opts.latitude,opts.longitude);var mapOptions={zoom:opts.zoom,center:LatLng,mapTypeControl:opts.mapTypeControl,zoomControl:opts.zoomControl,panControl:opts.panControl,scaleControl:opts.scaleControl,streetViewControl:opts.streetViewControl,mapTypeId:opts.maptype,scrollwheel:opts.scrollwheel};var $gmap=new googlemaps.Map(this,mapOptions);$this.data("$gmap",$gmap);var $geocoder=new googlemaps.Geocoder();if(opts.address){$geocoder.geocode({address:opts.address},function(result,status){if(status==google.maps.GeocoderStatus.OK){$gmap.setCenter(result[0].geometry.location);}else{if(opts.log)console.log("Geocode was not successful for the following reason: "+status);}});$gmap.setZoom(opts.zoom);}
else{if(opts.latitude&&opts.longitude){$gmap.setCenter(new googlemaps.LatLng(opts.latitude,opts.longitude),opts.zoom);}
else{if($.isArray(opts.markers)&&opts.markers.length>0){if(opts.markers[0].address){$geocoder.geocode({address:opts.markers[0].address},function(result,status){if(status==google.maps.GeocoderStatus.OK){$gmap.setCenter(result[0].geometry.location);}else{if(opts.log)console.log("Geocode was not successful for the following reason: "+status);}});}
else{$gmap.setCenter(new googlemaps.LatLng(opts.markers[0].latitude,opts.markers[0].longitude));$gmap.setZoom(opts.zoom);}}
else{$gmap.setCenter(new googlemaps.LatLng(opts.latitude,opts.longitude));$gmap.setZoom(opts.zoom);}}}
if(opts.controls.length!=0){for(var i=0;i',html_append:' ',icon:{image:"http://www.google.com/mapfiles/marker.png",shadow:"http://www.google.com/mapfiles/shadow50.png",iconsize:[20,34],shadowsize:[37,34],iconanchor:[9,34],infowindowanchor:[9,2]}}})(jQuery);
// source --> https://penkor.com.my/penkor/js/jquery.validate.js?ver=2f237cc19570fb25c85e1900ba8685da
/*
* jQuery validation plug-in 1.7
*
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
* http://docs.jquery.com/Plugins/Validation
*
* Copyright (c) 2006 - 2008 Jรถrn Zaefferer
*
* $Id: jquery.validate.js 6403 2009-06-17 14:27:16Z joern.zaefferer $
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
(function($){$.extend($.fn,{validate:function(options){if(!this.length){options&&options.debug&&window.console&&console.warn("nothing selected, can't validate, returning nothing");return;}var validator=$.data(this[0],'validator');if(validator){return validator;}validator=new $.validator(options,this[0]);$.data(this[0],'validator',validator);if(validator.settings.onsubmit){this.find("input, button").filter(".cancel").click(function(){validator.cancelSubmit=true;});if(validator.settings.submitHandler){this.find("input, button").filter(":submit").click(function(){validator.submitButton=this;});}this.submit(function(event){if(validator.settings.debug)event.preventDefault();function handle(){if(validator.settings.submitHandler){if(validator.submitButton){var hidden=$("